﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<AgriMarketWebProj.AgriMarketService.YProduct>>" %>
<%@ Import Namespace="AgriMarketWebProj.AgriMarketService" %>
<%@ Import Namespace="AgriMarketWebProj.Models" %>
<%@ Import Namespace="System.Web.Script.Serialization" %>
<%@ Import Namespace="System.Web.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    AgriMarket|Thống kê
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="server">
    <%= Html.ValidationSummary(false) %>
<%--    <%if (ViewData.ModelState != null) {
          foreach (var item in ViewData.ModelState)
          {
              Response.Write(item.Key+":"+item.Value.Errors[0].ErrorMessage+"\n");
          }
      } %>--%>
    <div class="caption" id="StatisticAndChartCaption"> <h2>Thông kế giá sản phẩm dựa theo kết quả đấu giá</h2></div>
    <form method="get" action='/Statistic/PriceTable'>
    <%="Từ: <input type='number' name='StartedYear' value='" + ViewBag.StartedYear + "' />"%>
    <%="Đến: <input type='number' name='FinishedYear' value='" + ViewBag.FinishedYear + "' />"%>
    <input type="submit" value='Lập bảng giá'/>
    </form>
      <table class="table tableStatistic" id="StatisticAndChartTable">
        <tr>
            <th>
                Stt
            </th>
            <th>
                ProductName
            </th>
            <th>
                Price
            </th>
        </tr>
    <%
        int i=1;
        foreach (var item in Model) { %>
        <tr>
            <td>
                <% Response.Write((i++).ToString()); %>
            </td>
            <td>
                <%: Html.DisplayFor(modelItem => item.Product.ProductName) %>
            </td>
            <td>
                <%: Html.DisplayFor(modelItem => item.Price) %>
            </td>
        </tr>
    <% } %>
    

    </table>
    <div id="StatisticAndChartImageDiv">
        <%
        List<YProduct> content = (List<YProduct>)Model;
        Response.Write("<img class='StatisticAndChartImage' src='" + Url.Action("DrawYearStatistic", new { start = ViewBag.StartedYear, finish = ViewBag.FinishedYear }) + "'></img>");
         %>
	</div>

         
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <link href="../../Content/Statistic.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/ThongKeBieuDo.css" rel="stylesheet" type="text/css" />
</asp:Content>

<%--<asp:Content ID="Content4" ContentPlaceHolderID="RightPanel" runat="server">
</asp:Content>--%>
